// RegisterObject.h: interface for the RegisterObject class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_REGISTEROBJECT_H__23031176_8499_4717_982F_DF892247484B__INCLUDED_)
#define AFX_REGISTEROBJECT_H__23031176_8499_4717_982F_DF892247484B__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "SmallObject.h"

class UeObject: public SmallObject
{
public:
	UeObject(){}
	virtual ~UeObject(){}

public:
	static const RuntimeClass_* RuntimeClass(){
		return UE_RUNTIME_CLASS(SmallObject);
	}
};

template <class ObjectStyle, class RegisterInfoTemplate> class RegisterObject :public UeObject 
{
public:
	RegisterObject(){};
	virtual ~RegisterObject(){};

	virtual const RegisterInfoTemplate* GetRegisterInfo() const = 0;

	typedef RegisterInfoTemplate RegisterInfo;
	typedef ObjectStyle Style;

};

#define DllExportData 

#ifdef _AFXDLL
#define DECLARE_DYNAMIC_EX(class_name) \
	UE_DECLARE_DYNAMIC(class_name)

#define _DECLARE_DYNAMIC_EX(class_name) \
	_UE_DECLARE_DYNAMIC(class_name)

#else
#define DECLARE_DYNAMIC_EX(class_name) \
	UE_DECLARE_DYNAMIC(class_name)

#define _DECLARE_DYNAMIC_EX(class_name) \
	_UE_DECLARE_DYNAMIC(class_name)

#endif

#define RUNTIME_CLASS_EX(class_name) UE_RUNTIME_CLASS(class_name)

typedef CRuntimeClass* (__stdcall *NONECONSTRUNTIMECLASS)();

#ifdef _AFXDLL
#define IMPLEMENT_RUNTIMECLASS_EX(class_name, base_class_name, wSchema, pfnNew) \
	const CRuntimeClass* PASCAL class_name::_GetBaseClass() \
		{ return RUNTIME_CLASS_EX(base_class_name); } \
	AFX_COMDAT const AFX_DATADEF CRuntimeClass class_name::class##class_name = { \
		#class_name, sizeof(class class_name), wSchema, pfnNew, \
		(NONECONSTRUNTIMECLASS)(&class_name::_GetBaseClass), NULL }; \
	CRuntimeClass* class_name::GetRuntimeClass() const \
		{ return RUNTIME_CLASS(class_name); } \
	const CRuntimeClass* class_name::RuntimeClass()\
		{return &class_name::class##class_name ;}\

#define _IMPLEMENT_RUNTIMECLASS_EX(class_name, base_class_name, wSchema, pfnNew) \
	const CRuntimeClass* PASCAL class_name::_GetBaseClass() \
		{ return RUNTIME_CLASS_EX(base_class_name); } \
	AFX_COMDAT AFX_DATADEF CRuntimeClass class_name::class##class_name = { \
		#class_name, sizeof(class class_name), wSchema, pfnNew, \
			(NONECONSTRUNTIMECLASS)(&class_name::_GetBaseClass), NULL }; \
	CRuntimeClass* class_name::GetRuntimeClass() const \
		{ return RUNTIME_CLASS(class_name); } \
	const CRuntimeClass* class_name::RuntimeClass()\
		{return &class_name::class##class_name ;}\

#else
#define IMPLEMENT_RUNTIMECLASS_EX(class_name, base_class_name, wSchema, pfnNew) \
	AFX_COMDAT const AFX_DATADEF CRuntimeClass class_name::class##class_name = { \
		#class_name, sizeof(class class_name), wSchema, pfnNew, \
			RUNTIME_CLASS_EX(base_class_name), NULL }; \
	CRuntimeClass* class_name::GetRuntimeClass() const \
		{ return RUNTIME_CLASS(class_name); } \
	const CRuntimeClass* class_name::RuntimeClass()\
		{return &class_name::class##class_name ;}\

#define _IMPLEMENT_RUNTIMECLASS_EX(class_name, base_class_name, wSchema, pfnNew) \
	AFX_DATADEF CRuntimeClass class_name::class##class_name = { \
		#class_name, sizeof(class class_name), wSchema, pfnNew, \
			RUNTIME_CLASS_EX(base_class_name), NULL }; \
	CRuntimeClass* class_name::GetRuntimeClass() const \
		{ return RUNTIME_CLASS(class_name); } \
	const CRuntimeClass* class_name::RuntimeClass()\
		{return &class_name::class##class_name ;}\

#endif

#define IMPLEMENT_DYNAMIC_EX(class_name, base_class_name) \
	UE_IMPLEMENT_DYNAMIC(class_name, base_class_name)


#define DECLARE_DYNAMIC_CREATE(class_name) \
	DECLARE_DYNAMIC_EX(class_name)\
public: \
	static const class_name::RegisterInfo Register##class_name; \
	virtual const class_name::RegisterInfo* GetRegisterInfo() const; \
	static class_name::Style* CreateObject();\

#define IMPLEMENT_DYNAMIC_CREATE(class_name, base_class, info_key) \
	IMPLEMENT_DYNAMIC_EX(class_name, base_class)\
	const class_name::RegisterInfo class_name::Register##class_name(info_key, #class_name, class_name::CreateObject);\
	const class_name::RegisterInfo* class_name::GetRegisterInfo()const {return &Register##class_name;}\
	class_name::Style* class_name::CreateObject(){return new class_name;}

#endif // !defined(AFX_REGISTEROBJECT_H__23031176_8499_4717_982F_DF892247484B__INCLUDED_)
